GARNAME = kickstart-oe
GARVERSION = 2.7.3
CATEGORIES = utils
MASTER_SITES = http://git.yoctoproject.org/cgit/cgit.cgi/poky/snapshot/
DISTFILES = \
	poky-yocto-$(GARVERSION).tar.bz2 \
	board-rpi2.conf             \
	board-rpi3.mainline32.conf  \
	board-rpi3.mainline64.conf  \
	board-rpi3.rpi32.conf       \
	board-s905.conf             \
	board-s912.conf             \
	board-g12.conf              \
	board-sm1.conf              \
	board-rk3328.beelink_a1.conf \
	board-rk3399.rockpi4-b.conf \
	board-h6.beelink_gs1.conf   \
	board-h6.eachlink_mini.conf \
	board-h6.tanix_tx6.conf     \
	board-rpi2.wks              \
	board-rpi3.mainline32.wks   \
	board-rpi3.mainline64.wks   \
	board-rpi3.rpi32.wks        \
	board-s905.wks              \
	board-s912.wks              \
	board-g12.wks               \
	board-sm1.wks               \
	board-rk3328.beelink_a1.wks \
	board-rk3399.rockpi4-b.wks  \
	board-h6.beelink_gs1.wks    \
	board-h6.eachlink_mini.wks  \
	board-h6.tanix_tx6.wks      \
	board-x86pc.bios.conf       \
	board-x86pc.bios.wks        \
	board-x86pc.efi64.conf      \
	board-x86pc.efi64.wks       \
	board-x86pc.bios_efi64.conf \
	board-x86pc.bios_efi64.wks  \
	default.wks                 \
	create-image.sh             \

PATCHFILES  = poky-yocto-2.7.3-bitbake-skip-python2-checks.patch
PATCHFILES += poky-yocto-2.7.3-add-biosplusefi-image-plugin.patch
PATCHFILES += poky-yocto-2.7.3-add-copy-mm2-files-into-image-boot-part.patch

WORKSRC = $(WORKDIR)/poky-yocto-$(GARVERSION)
LICENSE = GPL2

DESCRIPTION = 
define BLURB
endef

DEPENDS = \
	utils/diffstat \
	disk/dosfstools \
	disk/mtools \
	disk/e2fsprogs \
	disk/gptfdisk \
	utils/pseudo \
	lib/parted \
	bootloaders/syslinux \
	bootloaders/grub2 \
	python3/python \
	python3/python-codegen \
	python3/python-ply \
	python3/python-beautifulsoup4 \
	python3/python-simplediff \

CONFIGURE_SCRIPTS = 
BUILD_SCRIPTS     = 
INSTALL_SCRIPTS   = custom

include ../../gar.mk

install-custom:
	@mkdir -p $(DESTDIR)$(bindir)/kickstart/bitbake
	@mkdir -p $(DESTDIR)$(bindir)/kickstart/cache
	@mkdir -p $(DESTDIR)$(bindir)/kickstart/classes
	@mkdir -p $(DESTDIR)$(bindir)/kickstart/conf
	@mkdir -p $(DESTDIR)$(bindir)/kickstart/conf/multiconfig
	@mkdir -p $(DESTDIR)$(bindir)/kickstart/scripts
	@#
	@cp -rf $(WORKSRC)/bitbake/bin $(DESTDIR)$(bindir)/kickstart/bitbake/
	@cp -rf $(WORKSRC)/bitbake/lib $(DESTDIR)$(bindir)/kickstart/bitbake/
	@cp -rf $(WORKSRC)/meta/lib/oe $(DESTDIR)$(bindir)/kickstart/bitbake/lib/
	@#
	@cp -f $(WORKSRC)/meta/classes/base.bbclass          $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/logging.bbclass       $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/metadata_scm.bbclass  $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/mirrors.bbclass       $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/patch.bbclass         $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/sanity.bbclass        $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/staging.bbclass       $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/terminal.bbclass      $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/utility-tasks.bbclass $(DESTDIR)$(bindir)/kickstart/classes/
	@cp -f $(WORKSRC)/meta/classes/utils.bbclass         $(DESTDIR)$(bindir)/kickstart/classes/
	@#
	@cp -f $(WORKSRC)/meta/conf/abi_version.conf         $(DESTDIR)$(bindir)/kickstart/conf/
	@cp -f $(WORKSRC)/meta/conf/bitbake.conf             $(DESTDIR)$(bindir)/kickstart/conf/
	@cp -f $(WORKSRC)/meta/conf/sanity.conf              $(DESTDIR)$(bindir)/kickstart/conf/
	@cp -f $(WORKSRC)/meta/conf/multiconfig/default.conf $(DESTDIR)$(bindir)/kickstart/conf/multiconfig/
	@#
	@cp -rf $(WORKSRC)/scripts/lib/     $(DESTDIR)$(bindir)/kickstart/scripts/lib/
	@cp -f  $(WORKSRC)/scripts/wic      $(DESTDIR)$(bindir)/kickstart/scripts/wic
	@#
	@cp -f $(WORKDIR)/create-image.sh   $(DESTDIR)$(bindir)/kickstart/
	@#
	@cp -f $(WORKDIR)/board-*.conf      $(DESTDIR)$(bindir)/kickstart/conf/multiconfig/
	@cp -f $(WORKDIR)/board-*.wks       $(DESTDIR)$(bindir)/kickstart/
	@cp -f $(WORKDIR)/default.wks       $(DESTDIR)$(bindir)/kickstart/default.wks
	@#
	@# Remove all host tools requirements as we are listing them in BUILDEPS
	@sed -i -e "s/HOSTTOOLS +=/__HOSTTOOLS +=/g" $(DESTDIR)$(bindir)/kickstart/conf/bitbake.conf
	@echo 'HOSTTOOLS += " "' >> $(DESTDIR)$(bindir)/kickstart/conf/bitbake.conf
	@$(MAKECOOKIE)

clean-all:
	@rm -rf $(DESTDIR)$(bindir)/kickstart*
	@$(MAKECOOKIE)
